// -----------------------------------------------------------------------
//  <copyright file="IDaprPlusBuilder.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2024 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2024/12/13 21:19</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Builder;

/// <summary>
/// 定义DaprPlus构建器
/// </summary>
public interface IDaprPlusBuilder
{
    /// <summary>
    /// 获取 服务集合
    /// </summary>
    IServiceCollection Services { get; }

    /// <summary>
    /// 获取 DaprPlus上下文
    /// </summary>
    DaprPlusContext DaprPlusContext { get; }

    /// <summary>
    /// 获取 加载的模块集合
    /// </summary>
    ModuleBase[] Modules { get; }

    /// <summary>
    /// 从启动模块初始化应用程序
    /// </summary>
    /// <typeparam name="TStartupModule">启动模块类型</typeparam>
    void Build<TStartupModule>() where TStartupModule : ModuleBase;

    /// <summary>
    /// DaprPlus框架初始化，适用于Web应用程序
    /// </summary>
    /// <param name="app">Web应用程序对象</param>
    /// <returns></returns>
    Task<WebApplication> UseDaprPlus(WebApplication app);

    /// <summary>
    /// DaprPlus框架初始化，适用于非Web应用程序
    /// </summary>
    /// <param name="provider">服务提供者</param>
    /// <returns></returns>
    Task<IServiceProvider> UseDaprPlus(IServiceProvider provider);
}
